home *** CD-ROM | disk | FTP | other *** search
/ Champak 26 (Anniversary Edition) / Volume 26 [Anniversary Edition] - JOGO DISK .iso / DEPOSITO / REmovido / Esportes / airballs.swf / scripts / DefineSprite_22 / frame_2 / DoAction.as
Text File  |  2006-07-26  |  2KB  |  74 lines

  1. vy += gravity;
  2. _X = _X + vx;
  3. _Y = _Y + vy;
  4. ball._rotation += vx * 4;
  5. hittype = -1;
  6. if(bot < _Y)
  7. {
  8.    _Y = bot;
  9.    vy = (- vy) * 0.85;
  10.    vx *= 0.85;
  11.    if(Math.abs(vy) < 2)
  12.    {
  13.       if(_root.score.game)
  14.       {
  15.          _root.wrong.ballmc = this;
  16.          _root.wrong._x = _root.wrong.ballmc._x;
  17.          _root.wrong._y = _root.wrong.ballmc._y;
  18.          _root.gotoAndPlay("gameover");
  19.          vx = 0;
  20.       }
  21.       vy = - gravity;
  22.    }
  23.    else
  24.    {
  25.       _root.score.updatescore(1,6);
  26.    }
  27.    hittype = 0;
  28. }
  29. if(_X < left)
  30. {
  31.    vx = (- vx) * 0.9;
  32.    _X = left;
  33. }
  34. else if(right < _X)
  35. {
  36.    vx = (- vx) * 0.9;
  37.    _X = right;
  38. }
  39. if(hitTest(_root.alan.head))
  40. {
  41.    point.x = _root.alan.head._x;
  42.    point.y = _root.alan.head._y;
  43.    _root.alan.localToGlobal(point);
  44.    relx = point.x - _X;
  45.    rely = point.y - _Y;
  46.    dist = relx * relx + rely * rely;
  47.    if(ball.size >= dist)
  48.    {
  49.       force = _root.alan.force;
  50.       vel = Math.sqrt(vy * vy + vx * vx);
  51.       if(10 < vel)
  52.       {
  53.          vel = 10;
  54.       }
  55.       angle = Math.atan2(rely,relx);
  56.       angle = toprot + (angle - toprot) * 0.5;
  57.       angledeg = angle * 57.29577951308232;
  58.       xfactor = Math.cos(angle);
  59.       yfactor = Math.sin(angle);
  60.       vy = (- vel) * yfactor * force / ball.mass;
  61.       vx = (- vel) * xfactor * force / ball.mass;
  62.       _Y = _Y + vy;
  63.       _X = _X + vx;
  64.       _root.score.updatescore(_root.alan.points,6);
  65.       hittype = ball._currentframe;
  66.    }
  67. }
  68. if(_root.score.game && -1 < hittype)
  69. {
  70.    _root.hitsound.duplicateMovieClip("makehit",10);
  71.    _root.makehit.hit = hittype;
  72.    _root.makehit.gotoAndPlay(2);
  73. }
  74.